package cc.rengu.igas.share.facade.bean.cups;

import cc.rengu.oltp.service.common.enums.OltpRpcdEnum;
import cc.rengu.oltp.service.model.BizException;

import java.util.Arrays;

/**
 * F60.2.6  受理免验密码标志或跨境汇款业务到账币种
 *
 * @author fangminwei
 * @date 2021/4/17
 */
@SuppressWarnings("AlibabaEnumConstantsMustHaveComment")
public enum F60_2_6_CheckPsFlagTypeEnum {
    // 受理免验密码标志
    _0_CHECK("0", "非免验密码标志"),
    _1_UNCHECK("1", "免验密码标志"),

    // 跨境汇款业务到账币种
    _0_MAINACCT_CCY("0", "到账币种为收款人卡片主账户币种"),
    _2_ORGTXN_CCY("2", "表明到账币种为汇款人汇出原币种"),
    ;

    private String code;
    private String desc;

    F60_2_6_CheckPsFlagTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return code + "-" + desc;
    }

    public static F60_2_6_CheckPsFlagTypeEnum find(String code) {
        F60_2_6_CheckPsFlagTypeEnum result = Arrays.stream(F60_2_6_CheckPsFlagTypeEnum.values())
                .filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        if (result == null) {
            throw new BizException(OltpRpcdEnum.PARAM_IS_EMPTY_OR_NULL.getRespCode(), "找不到对应的枚举信息" + code);
        }
        return result;
    }
}
